﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace proRFID_DiemDanh.Users
{
    public partial class DangNhap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void cmd_Login_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_Username.Text) || string.IsNullOrEmpty(txt_Password.Text))
            {
                lbl_Thongbao.Text = "Nhập đầy đủ thông tin đăng nhập!";
                return;
            }

            DataTable dt = mdUsers.User_checkpass(txt_Username.Text, txt_Password.Text);
            if (Convert.ToInt16(dt.Rows[0]["ErrCode"]) == 0)
            {
                Session["Username"] = txt_Username.Text;// dua username sang trang khac
                Response.Redirect("../Chung/QuanLyDuLieu.aspx");
                //Response.Redirect("DoiMatKhau.aspx");
            }
            else
                lbl_Thongbao.Text = dt.Rows[0]["ErrMsg"].ToString();
        }
               
    }
}